﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PDFGenerator
{
    class Product
    {
        private string id;
        private string quantity;
        private string qType;
        private string price;
        private string spName;

        public Product(string id, string quantity, string qType, string price, string spName)
        {
            Id = id;
            Quantity = quantity;
            QType = qType;
            Price = price;
            SpName = spName;
        }

        public string Id
        {
            get
            {
                return this.id;
            }
            set
            {
                if (value != null && value != "")
                {
                    this.id = value;
                }
                else
                {
                    throw new ArgumentException("Invalid Id");
                }
            }
        }
        public string Quantity
        {
            get
            {
                return this.quantity;
            }
            set
            {
                if (value != null && value != "")
                {
                    this.quantity = value;
                }
                else
                {
                    throw new ArgumentException("Invalid Quantity");
                }
            }
        }
        public string QType
        {
            get
            {
                return this.qType;
            }
            set
            {
                if (value != null && value != "")
                {
                    this.qType = value;
                }
                else
                {
                    throw new ArgumentException("Invalid Quantity Type");
                }
            }
        }
        public string Price
        {
            get
            {
                return this.price;
            }
            set
            {
                if (value != null && value != "")
                {
                    this.price = value;
                }
                else
                {
                    throw new ArgumentException("Invalid Price");
                }
            }
        }
        public string Sum
        {
            get
            {
                return ((decimal)Convert.ToInt32(this.quantity) * Convert.ToDecimal(this.price)).ToString();
            }
        }
        public string SpName
        {
            get
            {
                return this.spName;
            }
            set
            {
                if (value != null && value != "")
                {
                    this.spName = value;
                }
                else
                {
                    throw new ArgumentException("Invalid Supermarket Name");
                }
            }
        }
    }
}
